import request from '@/utils/request'

// 分页列表
export function listSupplier(query) {
  return request({ url: '/ug/supplier/list', method: 'get', params: query })
}

// 详情
export function getSupplier(id) {
  return request({ url: `/ug/supplier/${id}` , method: 'get' })
}

// 新增
export function addSupplier(data) {
  return request({ url: '/ug/supplier', method: 'post', data })
}

// 更新
export function updateSupplier(data) {
  return request({ url: '/ug/supplier', method: 'put', data })
}

// 删除（支持批量）
export function delSupplier(ids) {
  const idStr = Array.isArray(ids) ? ids.join(',') : ids
  return request({ url: `/ug/supplier/${idStr}`, method: 'delete' })
}

// 状态变更
export function changeSupplierStatus(supplierId, status) {
  return request({ url: '/ug/supplier/changeStatus', method: 'put', data: { supplierId, status } })
}
